import pandas as pd
from scipy.special import gamma
import re

wD = pd.read_excel('WindData_whole.xls')

wD_avg = wD.mean()
wD_std = wD.std()

#计算平均风功率密度
k = (wD_std/wD_avg)**(-1.086)
c = wD_avg/gamma(1+1/k)

print('k和c:',k,c)
# wpd = 0.5*1.041*(c**3)*gamma(3/k+1)
# #print(wpd)
# print('各高度平均风能密度')
# for ch in wpd.index:
#     if ch.find('Avg')>=0 and int(re.findall(r'\d+',ch)[0])<6:
#         print(ch,':',format(wpd[ch],'.2f'))
